<script language='javascript'>
// JavaScript Document
$(function(){
	$("#form1 input[@type='text'],#form1 input[@type='password'],textarea").addClass('input_onFocus');
	$("#form1").validate({
//		debug :true,
//		success: function(label) {
//			label.html("<smart>$langCRight</smart>!").addClass("right");
//		},
		errorClass: "wrong",
		rules: {
			txtloginname: {required:true,minLength:5,maxLength:20},
			txtPassword: {required:true,minLength:6,maxLength:16},
			txtcheckpassword: {required:true,minLength:6,maxLength:16,equalTo:'#txtPassword'},
			txtemail: {required:true,email:true},
			txtecheckmail: {required:true,email:true,equalTo:'#txtemail'},
			code: {required:true}
		},
		messages: {
			txtloginname: {required: "<smart>$errMUserName_Blank</smart>",minLength: "<smart>$errMUserName_MinLength</smart>",maxLength: "<smart>$errMUserName_MaxLength</smart>"},
			txtPassword: {required: "<smart>$errMPassword_Blank</smart>",minLength: "<smart>$errMPassword_MinLength</smart>",maxLength: "<smart>$errMPassword_MaxLength</smart>"},
			txtcheckpassword: {required: "<smart>$errMRePassword_Blank</smart>",minLength: "<smart>$errMRePassword_MinLength</smart>",	maxLength: "<smart>$errMRePassword_MaxLength</smart>",equalTo:"<smart>$errMRePassword_Wrong</smart>"},
			txtemail: {required: "<smart>$errMEmail_Blank</smart>",email: "<smart>$errMEmail_Wrong</smart>"},
			txtecheckmail: {required: "<smart>$errMEmail_Blank</smart>",email: "<smart>$errMEmail_Wrong</smart>",equalTo:"<smart>$errMReEmail_Wrong</smart>"},
			code: {required: "验证码不能为空!"}
		}
	});
	$('table.bb tr td input[@type="text"],table.bb tr td input[@type="password"]').focus(function() { $(this).parent().next().find('label').addClass('label_focus') }).blur(function() { $(this).parent().next().find('label').removeClass('label_focus') });

	$("#sub_name").click(function(){
		if (''==$('#txtloginname').val()) {
			alert('请输入用户名！')
		}else{
			$.get("member.php",{action: "check",username:$('#txtloginname').val()},function(data){
				if ('0'==data) {alert("恭喜你，此用户可以注册！")}else {alert(data)}
	})	
		};
	});


})
</script>
